/**
 * 
 */
package masterlink.futures.vo;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author tonyyang
 *
 */
@Entity
@Table(name="fuhivabal")
public class Fuhivabal implements Serializable{

	private static final long serialVersionUID = 3310028624949520963L;
	
	@EmbeddedId
	private PK id;
	@Column(name="netvalue")
	private Double netvalue=0d;
	@Column(name="dw")
	private Double dw=0d;
	@Column(name="balance")
	private Long balance=0l;
	
	/**
	 * @return the id
	 */
	public PK getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(PK id) {
		this.id = id;
	}

	/**
	 * @return the netvalue
	 */
	public Double getNetvalue() {
		return netvalue;
	}

	/**
	 * @param netvalue the netvalue to set
	 */
	public void setNetvalue(Double netvalue) {
		this.netvalue = netvalue;
	}

	/**
	 * @return the dw
	 */
	public Double getDw() {
		return dw;
	}

	/**
	 * @param dw the dw to set
	 */
	public void setDw(Double dw) {
		this.dw = dw;
	}

	/**
	 * @return the balance
	 */
	public Long getBalance() {
		return balance;
	}

	/**
	 * @param balance the balance to set
	 */
	public void setBalance(Long balance) {
		this.balance = balance;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Fuhivabal [id=");
		builder.append(id);
		builder.append(", netvalue=");
		builder.append(netvalue);
		builder.append(", dw=");
		builder.append(dw);
		builder.append(", balance=");
		builder.append(balance);
		builder.append("]");
		return builder.toString();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Fuhivabal other = (Fuhivabal) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	@Embeddable
	public static class PK implements Serializable{

		private static final long serialVersionUID = 83859248075914213L;
		@Column(name="date1")
		private Long date1;
		@Column(name="broker_id")
		private String broker;
		@Column(name="acno")
		private String acno;
		/**
		 * @return the date1
		 */
		public Long getDate1() {
			return date1;
		}
		/**
		 * @param date1 the date1 to set
		 */
		public void setDate1(Long date1) {
			this.date1 = date1;
		}
		/**
		 * @return the broker
		 */
		public String getBroker() {
			return broker;
		}
		/**
		 * @param broker the broker to set
		 */
		public void setBroker(String broker) {
			this.broker = broker;
		}
		/**
		 * @return the acno
		 */
		public String getAcno() {
			return acno;
		}
		/**
		 * @param acno the acno to set
		 */
		public void setAcno(String acno) {
			this.acno = acno;
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#toString()
		 */
		@Override
		public String toString() {
			StringBuilder builder = new StringBuilder();
			builder.append("PK [date1=");
			builder.append(date1);
			builder.append(", broker=");
			builder.append(broker);
			builder.append(", acno=");
			builder.append(acno);
			builder.append("]");
			return builder.toString();
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#hashCode()
		 */
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((acno == null) ? 0 : acno.hashCode());
			result = prime * result
					+ ((broker == null) ? 0 : broker.hashCode());
			result = prime * result + ((date1 == null) ? 0 : date1.hashCode());
			return result;
		}
		/* (non-Javadoc)
		 * @see java.lang.Object#equals(java.lang.Object)
		 */
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			PK other = (PK) obj;
			if (acno == null) {
				if (other.acno != null)
					return false;
			} else if (!acno.equals(other.acno))
				return false;
			if (broker == null) {
				if (other.broker != null)
					return false;
			} else if (!broker.equals(other.broker))
				return false;
			if (date1 == null) {
				if (other.date1 != null)
					return false;
			} else if (!date1.equals(other.date1))
				return false;
			return true;
		}
		
	}

}
